%电机参数
Rs = 0.02;
Ls = 74e-6;

%期望的系统带宽
W=400*2*pi;

%pi控制器参数
Kp = W * Ls;
Ki = W * Rs;

%被控对象的模型
G_plant = tf(1/Ls, [1 Rs/Ls]);

%pi的传递函数
G_pi = Kp * tf([1 Ki/Kp], [1 0]);

%开环传递函数
G_Open = G_pi * G_plant;

%闭环传递函数
G_Close = G_Open/(1 + G_Open);

%bode图
bodeplot(G_Close, '-r');

%输入阶跃信号的输出信号
figure(1);
grid on;
figure(2);
step(G_Close, 0.01);
grid on;

bandwidth(G_Close)
bandwidth(G_plant)